using System;
using JGSY.CMS.LowCode.Platform.Domain.Interfaces;

namespace JGSY.CMS.LowCode.Platform.Domain.Entities
{
    /// <summary>
    /// 操作日志实体
    /// 用于记录系统中的各种操作活动和事件
    /// </summary>
    public class OperationLog : ITenantEntity
    {
        /// <summary>
        /// 操作日志标识符
        /// </summary>
        public long Id { get; set; }
        
        /// <summary>
        /// 跟踪标识符
        /// 用于关联同一次请求的多个日志记录
        /// </summary>
        public string? TraceId { get; set; }
        
        /// <summary>
        /// 日志级别
        /// 如：Debug、Info、Warning、Error、Critical
        /// </summary>
        public string? LogLevel { get; set; }
        
        /// <summary>
        /// 日志消息
        /// 操作的具体描述信息
        /// </summary>
        public string? Message { get; set; }
        
        /// <summary>
        /// 时间戳
        /// 操作发生的精确时间
        /// </summary>
        public DateTime Timestamp { get; set; }
        
        /// <summary>
        /// 用户标识符
        /// 执行操作的用户ID
        /// </summary>
        public string? UserId { get; set; }
        
        /// <summary>
        /// 请求路径
        /// HTTP请求的路径信息
        /// </summary>
        public string? RequestPath { get; set; }
        
        /// <summary>
        /// 异常信息
        /// 如果操作发生异常，记录异常的详细信息
        /// </summary>
        public string? Exception { get; set; }
        
        /// <summary>
        /// 额外数据
        /// 以JSON格式存储的其他相关信息
        /// </summary>
        public string? ExtraData { get; set; }

        /// <summary>
        /// 关联ID
        /// 分布式环境下的请求关联标识
        /// </summary>
        public string? CorrelationId { get; set; }

        /// <summary>
        /// 操作类型
        /// 如：Create、Update、Delete、View等
        /// </summary>
        public string? OperationType { get; set; }

        /// <summary>
        /// 操作名称
        /// 具体的操作描述
        /// </summary>
        public string? OperationName { get; set; }

        /// <summary>
        /// 描述信息
        /// 操作的详细描述
        /// </summary>
        public string? Description { get; set; }

        /// <summary>
        /// 用户名称
        /// 执行操作的用户名
        /// </summary>
        public string? UserName { get; set; }

        /// <summary>
        /// 租户ID
        /// 多租户环境下的租户标识
        /// </summary>
        public string TenantId { get; set; } = string.Empty;

        /// <summary>
        /// HTTP方法
        /// 如：GET、POST、PUT、DELETE
        /// </summary>
        public string? HttpMethod { get; set; }

        /// <summary>
        /// 持续时间
        /// 操作执行的耗时（毫秒）
        /// </summary>
        public long? Duration { get; set; }

        /// <summary>
        /// 操作是否成功
        /// </summary>
        public bool? Success { get; set; }

        /// <summary>
        /// 错误消息
        /// 如果操作失败，记录错误信息
        /// </summary>
        public string? ErrorMessage { get; set; }

        /// <summary>
        /// 请求数据
        /// HTTP请求的数据内容
        /// </summary>
        public string? RequestData { get; set; }

        /// <summary>
        /// 响应数据
        /// HTTP响应的数据内容
        /// </summary>
        public string? ResponseData { get; set; }

        /// <summary>
        /// 附加数据
        /// 其他相关的上下文信息
        /// </summary>
        public string? AdditionalData { get; set; }

        /// <summary>
        /// IP地址
        /// 客户端的IP地址
        /// </summary>
        public string? IpAddress { get; set; }

        /// <summary>
        /// 用户代理
        /// 客户端的用户代理字符串
        /// </summary>
        public string? UserAgent { get; set; }
    }
}
